package com.servers.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dao.ConsumerDao;
import com.entity.Consumer;
import com.servers.ConsumerServers;
@Service("consumerServers")
public class ConsumerServersImpl implements ConsumerServers{
	@Autowired
	private ConsumerDao consumerDao;
	
	public Consumer getConsumerInfoByCid(int cid) {

		return consumerDao.QueryConsumerInfoByCID(cid);
	}
	public Consumer getConsumerInfo(int cid,String address) {

		return consumerDao.QueryConsumerInfo(cid,address);
	}
	@Override
	public List<Consumer> userLogin(String uname, String pwd) {
		Consumer consumer = new Consumer();
		consumer.setCname(uname);
		consumer.setCpwd(pwd);
		return consumerDao.userLogin(uname, pwd);
	}
	
	@Override
	public int addConsumer(String uname, String pwd, String tel, String address) {
		Consumer consumer = new Consumer();
		consumer.setCname(uname);
		consumer.setCpwd(pwd);
		consumer.setCtel(tel);
		consumer.setCaddress(address);
		return consumerDao.addConsumer(uname, pwd, tel, address);
	}

	public void setConsumerDao(ConsumerDao consumerDao) {
		this.consumerDao = consumerDao;
	}
	@Override
	public Consumer userLoginDemo(String uname, String pwd) {
		// TODO Auto-generated method stub
		return consumerDao.userLoginDemo(uname, pwd);
	}
	@Override
	public Consumer getConsumerByName(String cname) {
		// TODO Auto-generated method stub
		return consumerDao.QueryConsumerInfoByName(cname);
	}
	@Override
	public List<Consumer> findAllConsumer() {
		// TODO Auto-generated method stub
		return consumerDao.findAllConsumer();
	}
	@Override
	public int deleteConsumer(int cid) {
		// TODO Auto-generated method stub
		return consumerDao.deleteConsumer(cid);
	}
	@Override
	public List<Consumer> findConsumerByCname(String cname) {
		// TODO Auto-generated method stub
		return consumerDao.findConsumerByCname(cname);
	}
	@Override
	public int updateConsumer(Consumer consumer) {
		// TODO Auto-generated method stub
		return consumerDao.updateConsumer(consumer);
	}
	@Override
	public int updateConsumePwd(int cid, String cpwd) {
		// TODO Auto-generated method stub
		return consumerDao.updateConsumePwd(cid, cpwd);
	}
	
}
